You are here: Statements and Functions > Variable()
Syntax samples
VARIABLE(<numeric expression>)
VARIABLE(Attr) = 124
VARIABLE(x) = VARIABLE(y)
N=VARIABLE(x) + VARIABLE(y) - 1
Converts a name-index number or integer to a variable name. Use this function when a numeric expression uses a variable whose name-index number is stored in an attribute, array, or variable.
Any logic.
Please note
You cannot use VARIABLE() in a PROMPT, INC, DEC, or READ statement.
Components
<numeric expression>
The name index number for a variable. You can determine the name-index number associated with a particular variable by the position of the variable record in the Variables module.
Example
.In the example below, parts of different types arrive at location In_Queue. Each entity type has a unique value for Attr1 that corresponds to the name-index number of a variable in the Variables module. Once parts arrive at In_Queue, they increment the variable specific to that entity type before routing to the location Process_Loc.
Process Table
Entity |
Location |
Operation (min) |
---|---|---|
All |
In_Queue |
VARIABLE(Attr1) = VARIABLE(Attr1) + 1 |
Routing Table
Blk |
Output |
Destination |
Rule |
Move Logic |
---|---|---|---|---|
1 |
All |
Process_Loc |
FIRST1 |
MOVE 1 |
LOC(), ENT(), and RES().